package com.manor.im.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.manor.common.bean.UserBean;
import com.tencent.imsdk.TIMMessageStatus;

/**
 * Created by cxf on 2017/8/14.
 * IM 聊天用户 实体类
 */

public class ImUserBean extends UserBean implements Parcelable {

    private String lastMessage;
    private int unReadCount;
    private String lastTime;
    private int fromType;
    private int msgType;
    private boolean anchorItem;
    private boolean hasConversation;
    private long lastTimeStamp;
    private boolean isNeedTip;
    private String tipContent;
    private TIMMessageStatus msgStatus;
    private boolean isSelf;


    public boolean isSelf() {
        return isSelf;
    }

    public void setSelf(boolean self) {
        isSelf = self;
    }

    public TIMMessageStatus getMsgStatus() {
        return msgStatus;
    }

    public void setMsgStatus(TIMMessageStatus msgStatus) {
        this.msgStatus = msgStatus;
    }

    public String getTipContent() {
        return tipContent;
    }

    public void setTipContent(String tipContent) {
        this.tipContent = tipContent;
    }

    public boolean isNeedTip() {
        return isNeedTip;
    }

    public void setNeedTip(boolean needTip) {
        isNeedTip = needTip;
    }

    public int getUnReadCount() {
        return unReadCount;
    }

    public void setUnReadCount(int unReadCount) {
        this.unReadCount = unReadCount;
    }

    public String getLastMessage() {
        return lastMessage;
    }

    public void setLastMessage(String lastMessage) {
        this.lastMessage = lastMessage;
    }

    public String getLastTime() {
        return lastTime;
    }

    public void setLastTime(String lastTime) {
        this.lastTime = lastTime;
    }

    public int getMsgType() {
        return msgType;
    }

    public void setMsgType(int msgType) {
        this.msgType = msgType;
    }

    public boolean isAnchorItem() {
        return anchorItem;
    }

    public void setAnchorItem(boolean anchorItem) {
        this.anchorItem = anchorItem;
    }

    public long getLastTimeStamp() {
        return lastTimeStamp;
    }

    public void setLastTimeStamp(long lastTimeStamp) {
        this.lastTimeStamp = lastTimeStamp;
    }

    public boolean isHasConversation() {
        return hasConversation;
    }

    public void setHasConversation(boolean hasConversation) {
        this.hasConversation = hasConversation;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        super.writeToParcel(dest, flags);
        dest.writeString(this.lastMessage);
        dest.writeInt(this.unReadCount);
        dest.writeString(this.lastTime);
        dest.writeInt(this.fromType);
        dest.writeInt(this.msgType);
        dest.writeByte(this.anchorItem ? (byte) 1 : (byte) 0);
        dest.writeByte(this.hasConversation ? (byte) 1 : (byte) 0);
        dest.writeLong(this.lastTimeStamp);
        dest.writeByte(this.isNeedTip ? (byte) 1 : (byte) 0);
        dest.writeString(this.tipContent);
        dest.writeInt(this.msgStatus == null ? -1 : this.msgStatus.ordinal());
        dest.writeByte(this.isSelf ? (byte) 1 : (byte) 0);
    }

    public ImUserBean() {
    }

    protected ImUserBean(Parcel in) {
        super(in);
        this.lastMessage = in.readString();
        this.unReadCount = in.readInt();
        this.lastTime = in.readString();
        this.fromType = in.readInt();
        this.msgType = in.readInt();
        this.anchorItem = in.readByte() != 0;
        this.hasConversation = in.readByte() != 0;
        this.lastTimeStamp = in.readLong();
        this.isNeedTip = in.readByte() != 0;
        this.tipContent = in.readString();
        int tmpMsgStatus = in.readInt();
        this.msgStatus = tmpMsgStatus == -1 ? null : TIMMessageStatus.values()[tmpMsgStatus];
        this.isSelf = in.readByte() != 0;
    }

    public static final Creator<ImUserBean> CREATOR = new Creator<ImUserBean>() {
        @Override
        public ImUserBean createFromParcel(Parcel source) {
            return new ImUserBean(source);
        }

        @Override
        public ImUserBean[] newArray(int size) {
            return new ImUserBean[size];
        }
    };


    @Override
    public String toString() {
        return "ImUserBean{" +
                "lastMessage='" + lastMessage + '\'' +
                ", unReadCount=" + unReadCount +
                ", lastTime='" + lastTime + '\'' +
                ", fromType=" + fromType +
                ", msgType=" + msgType +
                ", anchorItem=" + anchorItem +
                ", hasConversation=" + hasConversation +
                ", lastTimeStamp=" + lastTimeStamp +
                ", isNeedTip=" + isNeedTip +
                ", tipContent='" + tipContent + '\'' +
                ", msgStatus=" + msgStatus +
                ", isSelf=" + isSelf +
                '}';
    }



}
